package com.wlyuan.open.domain.source.service.impl;

import com.wlyuan.open.domain.source.service.IOpenTopExtensionService;
import com.wlyuan.open.dto.top.OpenTopExtensionOrderSyncDTO;
import com.wlyuan.open.remote.feign.TopWebFeignInvoker;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.springframework.stereotype.Service;

/**
 * @author yuanzheng
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class OpenTopExtensionServiceImpl implements IOpenTopExtensionService {
    private final TopWebFeignInvoker topWebFeignInvoker;


    @Override
    public Long sync(OpenTopExtensionOrderSyncDTO source) {
        var result = topWebFeignInvoker.rewrite(source);
        if (result.success()) {
            return result.getData();
        }
        return null;
    }
}
